package com.goldgov.route.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.goldgov.route.dao.RouteRuleDao;
import com.goldgov.route.service.ProjectRouteRule;
import com.goldgov.route.service.RouteRule;
import com.goldgov.route.service.RouteRuleService;
import com.goldgov.route.service.ServiceVersion;

/**
 * Route规则业务接口实现
 * @author LiuHG
 */
@Service
public class RouteRuleServiceImpl implements RouteRuleService{
	
    @Autowired
    private RouteRuleDao routeRuleDao;

    @Override
    public void addRouteRule(RouteRule routeRule){
        routeRuleDao.addRouteRule(routeRule);

	}
	
	@Override
	public void updateRouteRule(RouteRule routeRule){
        routeRuleDao.updateRouteRule(routeRule);

	}
	
	@Override
	public void deleteRouteRule(String[] ids){
        routeRuleDao.deleteRouteRule(ids);
	}
	
	@Override
	public RouteRule getRouteRule(String id){
        return routeRuleDao.getRouteRule(id);
	}
	
	@Override
	public List<RouteRule> listRouteRule(String[] excludeIDs){
        return routeRuleDao.listRouteRule(excludeIDs);
	}

	@Override
	public void deleteProjectRoute(String[] ids) {
		routeRuleDao.deleteProjectRoute(ids);
	}

	@Override
	public List<RouteRule> listRouteRuleByPorject(String projectID) {
		return routeRuleDao.listRouteRuleByPorject(projectID);
	}

	@Override
	@Transactional
	public void updateProjectRouteRule(String projectID , ProjectRouteRule[] rules){
		routeRuleDao.deleteProjectRouteRule(projectID);
		routeRuleDao.deleteProjectRouteRule(projectID);
        routeRuleDao.addProjectRoute(rules);

	}
	@Override
	public List<ServiceVersion> listVersion(String ruleID) {
		return routeRuleDao.listVersion(ruleID);
	}
	
}